package com.lifeng.client;

import com.lifeng.bean.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * Created by lifeng on 2018/4/25.
 */
@FeignClient("user-service-provider")
public interface UserServiceFeignClient {
    //value = "/user/{id}" 是 user-service-provider服务提供的url
    @RequestMapping(value = "/user/{id}",method = RequestMethod.GET)
    public User findById(@PathVariable("id") String id);
    //使用httpclient通讯 TODO 如何传输复杂对象
    @RequestMapping(value = "/user",method = RequestMethod.POST)
    public User save(@RequestParam("id") String id,@RequestParam("name") String name);

    @RequestMapping(value = "/user",method = RequestMethod.POST)
    public User save1(@RequestParam Map<String,Object> param);

    //TODO 如何传输复杂对象
    @RequestMapping(value = "/getUserVo",method = RequestMethod.GET)
    public User saveUserVo(@RequestBody User user);

    //TODO 如何传输复杂对象
    @RequestMapping(value = "/getUserMap",method = RequestMethod.POST)
    public Map<String,Object> saveUserMap(Map<String,Object> map);

    //TODO 如何传输复杂对象
    @RequestMapping(value = "/getUserList",method = RequestMethod.GET)
    public List<User> saveUserList(List<User> list);
}
